package com.tank.jdk8;

import com.tank.jdk8.stream.Student;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/1/26
 * Time: 17:09
 * To change this template use File | Settings | File Templates.
 */
public class OptionsTest {

    public static void main(String[] args) {

        Optional<String> optional = Optional.of("hello");
        //不推荐
//        if(optional.isPresent()){
//            System.out.println(optional.get());
//        }

//        optional.ifPresent(item -> System.out.println(optional.get()));
//
//        Student student = new Student("zhangsan",20);
//        Student student2 = new Student("lisi",21);
//
//        List<Student> studentList = Arrays.asList(student,student2);
//
//        Teacher teacher = new Teacher("tank");
//        teacher.setList(studentList);
//
//        Optional<Teacher> teacherOptional = Optional.of(teacher);
//        teacherOptional.map((t) -> t.getList() ).orElse(Collections.EMPTY_LIST);


    }
}

